VectorMap stores key-value pairs in an unordered vector and provides a simple find interface. More...
#include <kanzi/core/util/vector_map.hpp>
Public Member Functions | |
| auto && | at (size_t index) |
| Gets the item at a given integral index. | |
| auto && | at (size_t index) const |
| auto | begin () const noexcept |
| auto | begin () noexcept |
| Gets the begin iterator of the VectorMap. | |
| size_t | capacity () const noexcept |
| Gets the current capacity of the underlying vector. | |
| void | clear () noexcept |
| Clear the contents of the VectorMap. | |
| template<typename TComparableKey > | |
| bool | contains (const TComparableKey &searchKey) const |
| Tests if an element is contained in the VectorMap. | |
| auto | data () |
| Gets direct access to the underlying array. | |
| auto | data () const |
| template<typename... TArgs> | |
| auto & | emplace (TKey key, TArgs &&... args) |
| Emplace a new element in the VectorMap. | |
| auto | empty () const noexcept |
| Test if the VectorMap is empty. | |
| auto | end () const noexcept |
| auto | end () noexcept |
| Gets the begin iterator of the VectorMap. | |
| size_t | erase (const TKey &key) |
| Removes the element found by the given key. | |
| iterator | erase (iterator pos) |
| Removes the element at pos. | |
| template<typename TComparableKey > | |
| auto | find (const TComparableKey &searchKey) |
| Find an element in the VectorMap. | |
| template<typename TComparableKey > | |
| auto | find (const TComparableKey &searchKey) const |
| Find an element in the VectorMap. | |
| template<typename TComparableKey > | |
| auto && | operator[] (const TComparableKey &searchKey) |
| Find or Insert the given key. | |
| void | reserve (size_t newCapacity) |
| Reserve a capacity in the VectorMap. | |
| auto | size () const noexcept |
| Gets the size of the VectorMap. | |
VectorMap stores key-value pairs in an unordered vector and provides a simple find interface.
Intended for small lists, There is no checking for duplicate keys.
|
inline |
Find an element in the VectorMap.
Uses heterogeneous lookup on the search key.
| searchKey | The search key. |
|
inline |
Find an element in the VectorMap.
Uses heterogeneous lookup on the search key.
| searchKey | The search key. |
|
inline |
Emplace a new element in the VectorMap.
| key | The key. |
| args | The arguments used for value construction |
|
inline |
|
inline |
Find or Insert the given key.
The Value must be default constructible. Can use heterogeneous lookup on the search key, but the search key must be able to also construct a key.
| searchKey | The key to find or insert. |
|
inlinenoexcept |
Clear the contents of the VectorMap.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Gets the begin iterator of the VectorMap.
|
inlinenoexcept |
|
inlinenoexcept |
Gets the begin iterator of the VectorMap.
|
inlinenoexcept |
Gets direct access to the underlying array.
|
inline |
|
inline |
Reserve a capacity in the VectorMap.
| newCapacity | The new capacity. |
|
inlinenoexcept |
Gets the current capacity of the underlying vector.
|
inline |
Gets the item at a given integral index.
| index | The index to retreive. |
|
inline |
|
inline |
Removes the element at pos.
| pos | The position to remove. |
|
inline |
Removes the element found by the given key.
This does not use heterogenous lookup.
| key | The key to remove. |